package com.wanqing.community.dao.impl;

import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.wanqing.community.bean.MenuBean;
import com.wanqing.community.dao.MenuDao;
import com.wanqing.community.dao.util.MyBatisDao;
import com.wanqing.community.util.ConditionParse;

/**
 * 菜单管理DAO接口实现类
 * @version 
 * Company 
 */
@Repository("menuDao")
public class MenuDaoImpl extends MyBatisDao<MenuBean, String> implements MenuDao{
	
	private final String NAMES_SPACE = "com.wanqing.community.bean.MenuBean";

	
	public int getMenuCount(ConditionParse condParse) {		
		return getCount(NAMES_SPACE+".getMenuCount", condParse);
	}
	
	/**
	 * <p>Description:根据查询条件查询菜单列表<p>
	 * <p>modifiContent:</p>
	 * @param condParse
	 * @return
	 */
	public List<MenuBean> queryMenu(ConditionParse condParse) {		
		return queryForList(NAMES_SPACE+".queryMenu", condParse);
	}

	/**
	 * <p>Description:修改菜单的是否为根<p>
	 * <p>modifiContent:<p>
	 * @param mleaf
	 * @param id
	 * @return
	 */
	public int updateMenuLeaf(boolean mleaf, String id) {
		MenuBean mb = new MenuBean();
		mb.setMid(id);
		mb.setMleaf(mleaf);
		return update(NAMES_SPACE+".updateMenuLeaf", mb);
	}
	
	/**
	 * <p>Description:添加菜单<p>
	 * <p>modifiContent:<p>
	 * @param menuBean
	 * @return
	 */
	public int addMenu(MenuBean menuBean) {
		return this.save(NAMES_SPACE+".addMenu", menuBean);
	}

	/**
	 * <p>Description:查询所有的菜单信息<p>
	 * <p>modifiContent:<p>
	 * @return
	 */
	public List<MenuBean> listMenu() {		
		return this.queryForList(NAMES_SPACE+".listMenu");
	}
	
	/**
	 * <p>Description:通过ID查找菜单信息<p>
	 * <p>modifiContent:<p>
	 * @param id
	 * @return
	 */
	public MenuBean findMenuById(String id) {		
		return this.findObjectById(NAMES_SPACE+".findMenuById", id);
	}

	/**
	 * <p>Description:删除菜单<p>
	 * <p>modifiContent:<p>
	 * @param list
	 * @return
	 */
	public int deleteMenu(List<String> list) {
		return this.deleteBatchById(NAMES_SPACE+".deleteMenu", list);
	}

	/**
	 * <p>Description:分页查询菜单信息<p>
	 * <p>modifiContent:<p>
	 * @param condParse
	 * @param currPage
	 * @param pageSize
	 * @return
	 */
	public List<MenuBean> queryMenu(ConditionParse condParse, int currPage,
			int pageSize) {		
		return this.queryForList(NAMES_SPACE+".queryMenuPage", condParse, currPage, pageSize);
	}

	/**
	 * <p>Description:修改菜单<p>
	 * <p>modifiContent:<p>
	 * @param menu
	 * @return
	 */
	public int updateMenu(MenuBean menu) {		
		return this.update(NAMES_SPACE+".updateMenu", menu);
	}

	/**
	 * <p>Description:查询所有的菜单以及对应的按钮，业务功能<p>
	 * <p>modifiContent:<p>
	 * @return
	 */
	public List<MenuBean> listAuthorMenu() {		
		return this.queryForList(NAMES_SPACE+".listAuthorMenu");
	}

	/**
	 * <p>Description:查询权限菜单<p>
	 * <p>modifiContent:<p>
	 * @param paramsMap
	 * @return
	 */
	public List<MenuBean> queryMenuAcl(ConditionParse condParse) {	
		return this.queryForList(NAMES_SPACE+".queryMenuAcl", condParse);
	}
	
	public List<MenuBean> queryAclMenuAndOper(Map<String, Object> paramsMap) {		
		return this.queryForList(NAMES_SPACE+".queryAclMenuAndOper", paramsMap);
	}

}
